<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件
//获取图片位置
function get_img($name){
    if(config('use_qiniou')){
        return config('qiniou_url').'/'.$name;
    }else{
        return config('fuwuqi').'/'.$name;
    }
}
function is_mobile()
{
        $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
        $is_pc = (strpos($agent, 'windows nt')) ? true : false;
        $is_mac = (strpos($agent, 'mac os')) ? true : false;
        $is_iphone = (strpos($agent, 'iphone')) ? true : false;
        $is_android = (strpos($agent, 'android')) ? true : false;
        $is_ipad = (strpos($agent, 'ipad')) ? true : false;

        if($is_iphone){
              return  true;
        }
        if($is_android){
              return  true;
        }
        if($is_ipad){
              return  true;
        }
        if($is_pc){
              return  false;
        }
        if($is_mac){
              return  false;
        }
        return false;
}
function getFilePath($str){
    $str = (\think\Db::name('enclosure')->where('id',$str)->find())['path'];
    return $str;
}
function strGoArray($str){
    return preg_split('/[,;，；\r\n]+/', trim($str, ",;\r\n"));
}
function getConfig($str){
    $data = \think\Db::name('conf')->where('enname',$str)->find();
    return $data['value'];
}